package com.spikything.gfx {
	
	import flash.text.AntiAliasType;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import Globals;
	import Style;

	public class TextLabel extends TextField {
		
		public function TextLabel (txt:String = "", format:TextFormat = null, isHtml:Boolean = false, widthLimit:Number = 0) {
			super();
			
			mouseEnabled = false;
			selectable = false;
			formatText(format);
			
			if (isHtml) {
				htmlText = txt;
			} else {
				text = txt;
			}
			
			if (widthLimit) {
				multiline = true;
				wordWrap = true;
				width = widthLimit;
			}
			
		}
		
		protected function formatText (format:TextFormat):void {
			if (!format) format = new TextFormat(Style.BODY_TEXT_FONT, 12, 0xff0000);
			defaultTextFormat = format;
			//antiAliasType = AntiAliasType.ADVANCED;
			//autoSize = TextFieldAutoSize.LEFT;
			autoSize = TextFieldAutoSize.CENTER;
			if (format.font != "_sans") embedFonts = true;
		}
		
	}
	
}